home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / LGP250S1.ZIP / src / libgplus.5 / libgplus / test-ins / makefile.in < prev   
Makefile  |  1993-06-02  |  4KB  |  172 lines

  1. ###*#######################################################################
  2. #
  3. # Makefile to test the installation of g++ and libg++
  4. # (by hgs@cygnus.com)
  5. # Usage: make foo_main test-90S test-90D PREFIX=prefix [other macros]
  6.  
  7. srcdir = .
  8.  
  9.  
  10. #
  11. # Compilation macros
  12. #
  13. PREFIX        = $(prefix)
  14.  
  15. CFLAGS        =
  16. CXXFLAGS    =
  17. CPP_FLAGS    = #-I$(srcdir)/../g++-include
  18. OPTIMIZE_FLAGS    = -O
  19. DEBUG_FLAGS    = -g -v #-Wall
  20. COMPILE_FLAGS=$(NOSTDINC) -I.. -I$(srcdir) -I$(srcdir)/../src -I$(srcdir)/../$(IO_DIR) $(WRAP_C_INCLUDES) $(XTRAFLAGS) 
  21.  
  22.  
  23. DEPEND_SOURCES = $(srcdir)/*.cc
  24.  
  25.  
  26. T90  = $(T90S) $(T90D)
  27. T90D =  # dex_bar
  28.  
  29. FLAGS_90 = \
  30.  GXX="$(GXX)"\
  31.  CPP_FLAGS="$(CPP_FLAGS)"\
  32.  OPTIMIZE_FLAGS="$(OPTIMIZE_FLAGS)"\
  33.  DEBUG_FLAGS="$(DEBUG_FLAGS)"\
  34.  GXXLDFLAGS="$(GXXLDFLAGS)"
  35.  
  36. #### package, host, target, and site dependent Makefile fragments come in here.
  37. ##
  38.  
  39.  
  40. TEMP_FILES = *.o foo_main a b *foo_main.out *foo_main.diff *foo_main.run
  41.  
  42. help:
  43.     @echo Usage: make foo_main test-40 test-90S test-90D PREFIX=prefix [other macros]
  44.  
  45.  
  46. test-90S: foo_main a b
  47.  
  48. test-90S-then-clean: test-90S
  49.     rm -f ${TEMP_FILES}
  50.  
  51. test-90D: dfoo_main da db
  52.  
  53. test-90D-then-clean: test-90D
  54.     rm -f ${TEMP_FILES}
  55.  
  56. test: $(TEST)
  57.     for P in $(TEST) ; do if [ $$P != foo_main ]; then eval ./$$P; fi; done
  58.  
  59. a : a.o
  60.     $(CXX) -o a  a.o $(LIBS)
  61. da : a.o
  62.     $(CXX) -o da -dynamic  a.o $(LIBS)
  63.  
  64.  
  65. b : bf.o bm.o
  66.     $(CXX) -o b bm.o bf.o $(LIBS)
  67.  
  68. db : bf.o bm.o
  69.     $(CXX) -o db -dynamic bm.o bf.o $(LIBS)
  70.  
  71.  
  72. foo_main:   foo_main.diff
  73.     @true
  74.  
  75. dfoo_main: dfoo_main.diff
  76.     @true
  77.  
  78. foo_main.run: foo_main.o foo_func.o Foo.o expected.out
  79.     $(CXX) $(DEBUG_FLAGS) -o $@  foo_main.o foo_func.o Foo.o
  80.  
  81. foo_main.out: foo_main.run
  82.     ./foo_main.run > foo_main.out
  83.  
  84. foo_main.diff: foo_main.out $(srcdir)/expected.out
  85.     @echo "diff $(srcdir)/expected.out foo_main.out >foo_main.diff"
  86.     @diff $(srcdir)/expected.out foo_main.out >foo_main.diff \
  87.       || (echo "Static constructor test failed - see libg++/README"; false)
  88.  
  89. dfoo_main.run: foo_main.o foo_func.o Foo.o
  90.     $(CXX) $(DEBUG_FLAGS) -o $@ -dynamic foo_main.o foo_func.o Foo.o $(LIBS)
  91.  
  92. dfoo_main.out: dfoo_main.run
  93.     ./dfoo_main.run > dfoo_main.out
  94.  
  95. dfoo_main.diff: dfoo_main.out $(srcdir)/expected.out
  96.     diff $(srcdir)/expected.out dfoo_main.out
  97.  
  98. ex_bar.o: ex_bar.cc
  99.     $(CXX) -fhandle-exceptions ex_bar.cc
  100.  
  101. ex_bar: ex_bar.o
  102.     $(CXX) $(DEBUG_FLAGS) -o $@ ex_bar.o
  103.  
  104. dex_bar: ex_bar.o
  105.     $(CXX) $(DEBUG_FLAGS) -o $@ -dynamic ex_bar.o
  106.  
  107. # --- Generate depend rules ---
  108.  
  109. SRCDIR=$(srcdir)/..
  110.  
  111. # The sed script below attempts to make the depend output portable by
  112. # making the output use the same macros used elsewhere in the Makefile:
  113. # - It replaces double // by a single /.
  114. # - It replaces include files that match part of the GXX_INCLUDE_DIRS
  115. #   by names defined in terms of the macros used to define GXX_INCLUDE_DIRS.
  116. # - It removes any absolute include file names that remain.
  117. # - then remove lines, which contain only `\'
  118. #
  119. depend: depend.tmp
  120.     if [ "x$(DEPEND_SOURCES)" != "x" ] ; then \
  121.     sed < depend.tmp \
  122.       -e 's|//|/|g' \
  123.       -e 's|$(srcdir)|$$(srcdir)|g' \
  124.       -e 's| /[^ ]*[.]h||g' \
  125.       -e 's|: *\$$(srcdir)/\(.*\.[cC]*\)|: \1|' \
  126.       -e '/^[     ]*\\$$/d' -e 's/^[     ]*$$//' \
  127.     | awk 'BEGIN   { prev = "" } \
  128.           /^( )*$$/ { if (prev ~ /\\$$/) \
  129.              { prev = substr(prev,1,length(prev)-1); next } \
  130.                } \
  131.                        { print prev; prev = $$0 } \
  132.            END { if (prev !~ /^( )*$$/) print prev }' \
  133.     > $(srcdir)/depend ;\
  134.     fi
  135.  
  136. depend.tmp: $(DEPEND_SOURCES) 
  137.     if [ "x$(DEPEND_SOURCES)" = "x" ] ; then \
  138.       echo "" > $(srcdir)/depend ;\
  139.     else \
  140.     echo "" >depend.tmp ; \
  141.     $(SRCDIR)/utils/g++dep.sh -f depend.tmp $(GXX_INCLUDE_DIRS) \
  142.       $(DEPEND_SOURCES) ;\
  143.     fi
  144.  
  145. do_depend: depend
  146.     if [ "$(SUBDIRS)" != "" ] ; then \
  147.     for D in $(SUBDIRS) x ; do                \
  148.         if [ -d $$D ] ; then            \
  149.         echo "cd $$D; $(MAKE) do_depend" ; \
  150.         (cd $$D ; $(MAKE) do_depend );       \
  151.         fi ;                   \
  152.     done ;\
  153.     fi
  154.     
  155. # DO NOT DELETE THIS LINE -- g++dep uses it.
  156. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
  157.  
  158. Foo.o : Foo.cc \
  159.   $(srcdir)/Foo.h
  160. a.o : a.cc 
  161. bf.o : bf.cc 
  162. bm.o : bm.cc 
  163. ex_bar.o : ex_bar.cc \
  164.   $(srcdir)/ex_bar.cc
  165. foo_func.o : foo_func.cc \
  166.   $(srcdir)/Foo.h
  167. foo_main.o : foo_main.cc \
  168.   $(srcdir)/Foo.h
  169.  
  170. # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
  171.